package andy.demo.data;

import java.io.Serializable;

/**
 * 
 * app没有运行的状态下，后台服务弹出dialog和notification<br>
 * type=0表示弹框 <br>
 * type=1表示通知栏通知"正在看你"<br>
 * type=2表示通知栏通知"新私信和新系统通知"<br>
 * type=3表示通知栏“私信”语音
 * 
 * @author wangdw
 * 
 */
public abstract class NotifyBase implements Serializable {
    private static final long serialVersionUID = -711873380252226858L;
    public String type = null;
    public String id = null;
    public String time = null;

    public enum DisplayType {
        ERROR, DIALOG, NOTIFICATION
    }

    static public DisplayType getDisplayType(String typeStr) {

        try {
            int type = Integer.valueOf(typeStr);

            if (type == 0) {
                return DisplayType.DIALOG;
            } else if (type >= 1 && type <= 3) {
                return DisplayType.NOTIFICATION;
            } else {
                return DisplayType.ERROR;
            }
        } catch (NumberFormatException e) {
            System.out.println(e.getMessage());
            return DisplayType.ERROR;
        }

    }
    
    public abstract String toString();
}
